<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	version="1.0">

	<xsl:output method="xml" indent="yes" />

	<xsl:template match="/">
		<SecretsReport>
			<xsl:for-each select="Friends/Friend">
				<xsl:value-of select="@nick_name" />
			</xsl:for-each>
			<xsl:for-each
				select="document('DirtySecrets.xml')/Friends/Friend">
				<xsl:value-of select="@nick_name" />
			</xsl:for-each>
			<xsl:for-each select="Friends/Friend">
				<xsl:variable name="friend_nick_name"
					select="@nick_name" />
				<xsl:for-each
					select="document('DirtySecrets.xml')/Friends/Friend[@nick_name = $friend_nick_name]">
					<Secret>
						<Friend nick_name="{@nick_name}">
							<xsl:value-of select="./text()" />
						</Friend>
					</Secret>
				</xsl:for-each>
			</xsl:for-each>
		</SecretsReport>
	</xsl:template>
</xsl:stylesheet>
